package cn.starsray.common;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
public class CommonPage<T> implements Serializable {
    protected List<T> records;
    protected long total;
    protected long current;
    protected long size;


    public static <T> CommonPage<T> getPage(Page<T> page) {
        CommonPage<T> commonPage = new CommonPage<>();
        commonPage.setCurrent(page.getCurrent());
        commonPage.setRecords(page.getRecords());
        commonPage.setTotal(page.getTotal());
        commonPage.setSize(page.getSize());
        return commonPage;
    }
}
